package com.example.demo77.aa;

import com.example.demo77.entity.Teacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Arrays;

@Controller
@PropertySource(value= "classpath:application.yml")
public class Hello {
    /**
    @RequestMapping("hello11")
    @ResponseBody
    */
    @Value("${neu.className}")
    private String className;

    @Autowired
    private Teacher teacher;



    @RequestMapping("hello11")
    @ResponseBody//json格式返回
    public String hello(){
        /**
         *${}：可以取环境变量中的值，只是取值
         *#{}：字符串做""，数值不加
         */



        return "课程名称：" + className + "，上课人数：" + teacher.getAccount() + ",序号:"+ teacher.getId()+"技能:"+ Arrays.toString(teacher.getJob())+",hello spring boot";
    }

}
